Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@spearwolf/offscreen-display
Advanced tools
A minimal javascript library that makes it pretty easy for you to create a custom element that creates an offline canvas in a web worker and renders it in the animation frame loop of the browser.
Whether webgl, webgpu or 2d context is up to the user, the class takes care of the synchronization of the element dimension and rendering of the frames.
➜ npm i -D @spearwolf/offscreen-display
To get started quickly, vite is recommended, but this is purely optional and a matter of taste.
awesome-display.js
import {OffscreenDisplay} from '@spearwolf/offscreen-display';
class AwesomeDisplay extends OffscreenDisplay {
createWorker() {
return new Worker(new URL('awesome-display-worker.js', import.meta.url), {
type: 'module',
});
}
}
customElements.define('awesome-display', AwesomeDisplay);
index.html
<html>
<body>
<awesome-display></awesome-display>
<script type="module" src="awesome-display.js"></script>
</body>
</html>
awesome-display-worker.js
import {OffscreenWorkerDisplay} from '@spearwolf/offscreen-display/worker.js';
const display = new OffscreenWorkerDisplay();
let ctx = null;
display.on({
onCanvas({canvas}, contextAttributes) {
ctx = canvas.getContext('2d', contextAttributes);
},
onFrame({now, canvasWidth: w, canvasHeight: h}) {
ctx.clearRect(0, 0, w, h);
},
});
self.addEventListener('message', (evt) => {
display.parseMessageData(evt.data);
});
There are other features not listed here. For a complete example, see the rainbow line element.
Copyright © 2024 by Wolfger Schramm.
The source code and npm package is licensed under the Apache-2.0 License.
have fun! 🚀🌱
v0.1.2
OffscreenDisplay
classFAQs
helpers for creating custom offscreen canvas elements
We found that @spearwolf/offscreen-display demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.